<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: ailayer_batch_norm Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structailayer__batch__norm.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-attribs">Data Fields</a>  </div>
  <div class="headertitle">
<div class="title">ailayer_batch_norm Struct Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>General <a class="el" href="ailayer__batch__normalization_8h.html">Batch Normalization layer </a> structure.  
 <a href="structailayer__batch__norm.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="ailayer__batch__normalization_8h_source.html">ailayer_batch_normalization.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:ab13782a46e3804246bf82a92955096b3"><td class="memItemLeft" align="right" valign="top"><a id="ab13782a46e3804246bf82a92955096b3"></a>
<a class="el" href="structailayer.html">ailayer_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#ab13782a46e3804246bf82a92955096b3">base</a></td></tr>
<tr class="memdesc:ab13782a46e3804246bf82a92955096b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inherited field members from general ailayer struct. <br /></td></tr>
<tr class="separator:ab13782a46e3804246bf82a92955096b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Layer configuration</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Required configuration parameters for the layer</p>
<p>These fields have to be configured by the user before calling the initializer function. </p>
</div></td></tr>
<tr class="memitem:afcee94774a3c5f173a071b67da9cc3a5"><td class="memItemLeft" align="right" valign="top"><a id="afcee94774a3c5f173a071b67da9cc3a5"></a>
int8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a></td></tr>
<tr class="memdesc:afcee94774a3c5f173a071b67da9cc3a5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Index of the channel axis (1 for channels first, -1 for channels last) <br /></td></tr>
<tr class="separator:afcee94774a3c5f173a071b67da9cc3a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4be2a7d03bb9aeca3a064739b167098a"><td class="memItemLeft" align="right" valign="top"><a id="a4be2a7d03bb9aeca3a064739b167098a"></a>
void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a4be2a7d03bb9aeca3a064739b167098a">momentum</a></td></tr>
<tr class="memdesc:a4be2a7d03bb9aeca3a064739b167098a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Momentum for the exponential moving average of means and variances. <br /></td></tr>
<tr class="separator:a4be2a7d03bb9aeca3a064739b167098a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a642324fdce94ffd7d353846649fd5c3f"><td class="memItemLeft" align="right" valign="top"><a id="a642324fdce94ffd7d353846649fd5c3f"></a>
void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a></td></tr>
<tr class="memdesc:a642324fdce94ffd7d353846649fd5c3f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Small constant for numeric stability. <br /></td></tr>
<tr class="separator:a642324fdce94ffd7d353846649fd5c3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Trainable parameters</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Data fields for the trainable parameters (beta, gamma) of the layer </p>
</div></td></tr>
<tr class="memitem:a88bc32827b45ca03a858d6dbc85b9a48"><td class="memItemLeft" align="right" valign="top"><a id="a88bc32827b45ca03a858d6dbc85b9a48"></a>
<a class="el" href="structaitensor.html">aitensor_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a88bc32827b45ca03a858d6dbc85b9a48">betas</a></td></tr>
<tr class="memdesc:a88bc32827b45ca03a858d6dbc85b9a48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Vector of the shift parameters ( \( \beta_i \)). <br /></td></tr>
<tr class="separator:a88bc32827b45ca03a858d6dbc85b9a48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81edfab4c4a52c6537f3f0ee19a0d2a4"><td class="memItemLeft" align="right" valign="top"><a id="a81edfab4c4a52c6537f3f0ee19a0d2a4"></a>
<a class="el" href="structaitensor.html">aitensor_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a81edfab4c4a52c6537f3f0ee19a0d2a4">gammas</a></td></tr>
<tr class="memdesc:a81edfab4c4a52c6537f3f0ee19a0d2a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Vector of the scale parameters ( \( \gamma_i \)). <br /></td></tr>
<tr class="separator:a81edfab4c4a52c6537f3f0ee19a0d2a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae61aaf16d54970d405095a058b233656"><td class="memItemLeft" align="right" valign="top"><a id="ae61aaf16d54970d405095a058b233656"></a>
<a class="el" href="structaitensor.html">aitensor_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#ae61aaf16d54970d405095a058b233656">moving_means</a></td></tr>
<tr class="memdesc:ae61aaf16d54970d405095a058b233656"><td class="mdescLeft">&#160;</td><td class="mdescRight">Vector of the moving averages of the means (required for inference). <br /></td></tr>
<tr class="separator:ae61aaf16d54970d405095a058b233656"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab30bca8df727bfc450468830d31adf1c"><td class="memItemLeft" align="right" valign="top"><a id="ab30bca8df727bfc450468830d31adf1c"></a>
<a class="el" href="structaitensor.html">aitensor_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#ab30bca8df727bfc450468830d31adf1c">moving_variances</a></td></tr>
<tr class="memdesc:ab30bca8df727bfc450468830d31adf1c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Vector of the moving averages of the variance (required for inference). <br /></td></tr>
<tr class="separator:ab30bca8df727bfc450468830d31adf1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afcc6c64ff572ae7408fe1c4bcfe7b9d1"><td class="memItemLeft" align="right" valign="top"><a id="afcc6c64ff572ae7408fe1c4bcfe7b9d1"></a>
<a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#afcc6c64ff572ae7408fe1c4bcfe7b9d1">trainable_params</a> [2]</td></tr>
<tr class="memdesc:afcc6c64ff572ae7408fe1c4bcfe7b9d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to \( \beta \) and \( \gamma \) (which are the trainable parameters). <br /></td></tr>
<tr class="separator:afcc6c64ff572ae7408fe1c4bcfe7b9d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33b189c78566d57ad498dbf2cc364917"><td class="memItemLeft" align="right" valign="top"><a id="a33b189c78566d57ad498dbf2cc364917"></a>
<a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a33b189c78566d57ad498dbf2cc364917">gradients</a> [2]</td></tr>
<tr class="memdesc:a33b189c78566d57ad498dbf2cc364917"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gradients of \( \beta \) and \( \gamma \) for the back propagation algorithm. <br /></td></tr>
<tr class="separator:a33b189c78566d57ad498dbf2cc364917"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a590c48e998a8a740439e38d0aa4302dd"><td class="memItemLeft" align="right" valign="top"><a id="a590c48e998a8a740439e38d0aa4302dd"></a>
void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a590c48e998a8a740439e38d0aa4302dd">optimem</a> [2]</td></tr>
<tr class="memdesc:a590c48e998a8a740439e38d0aa4302dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Memory field used by the trainings optimizer. <br /></td></tr>
<tr class="separator:a590c48e998a8a740439e38d0aa4302dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Variables for internal computation</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>These fields are automatically configured in the initializer function. </p>
</div></td></tr>
<tr class="memitem:a0d74b4e482c87c09c71d74cce56ba157"><td class="memItemLeft" align="right" valign="top"><a id="a0d74b4e482c87c09c71d74cce56ba157"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a0d74b4e482c87c09c71d74cce56ba157">parameter_shape</a> [1]</td></tr>
<tr class="memdesc:a0d74b4e482c87c09c71d74cce56ba157"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shape of the parameter vectors ( \( \beta, \gamma, \mu, \sigma^2 \)). <br /></td></tr>
<tr class="separator:a0d74b4e482c87c09c71d74cce56ba157"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab11481f30ddb112f3febd5f656e6f238"><td class="memItemLeft" align="right" valign="top"><a id="ab11481f30ddb112f3febd5f656e6f238"></a>
<a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a></td></tr>
<tr class="memdesc:ab11481f30ddb112f3febd5f656e6f238"><td class="mdescLeft">&#160;</td><td class="mdescRight">Vector of the means ( \( \mu_i \)). <br /></td></tr>
<tr class="separator:ab11481f30ddb112f3febd5f656e6f238"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4cb00bf5961c120ec73810203638243e"><td class="memItemLeft" align="right" valign="top"><a id="a4cb00bf5961c120ec73810203638243e"></a>
<a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a></td></tr>
<tr class="memdesc:a4cb00bf5961c120ec73810203638243e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Vector of the variances ( \( \sigma^2_i \)). <br /></td></tr>
<tr class="separator:a4cb00bf5961c120ec73810203638243e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Math functions</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Required data type specific math functions </p>
</div></td></tr>
<tr class="memitem:a7a06fdbdd9e5f95ddc00f8bf65297f65"><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a7a06fdbdd9e5f95ddc00f8bf65297f65">empirical_mean_channelwise</a> )(const <a class="el" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="el" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>)</td></tr>
<tr class="memdesc:a7a06fdbdd9e5f95ddc00f8bf65297f65"><td class="mdescLeft">&#160;</td><td class="mdescRight">Required math function: Channel-wise empirical mean calculation.  <a href="structailayer__batch__norm.html#a7a06fdbdd9e5f95ddc00f8bf65297f65">More...</a><br /></td></tr>
<tr class="separator:a7a06fdbdd9e5f95ddc00f8bf65297f65"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a05a2db6bf3cc2160f0b13c6cb3e31a18"><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a05a2db6bf3cc2160f0b13c6cb3e31a18">empirical_variance_channelwise</a> )(const <a class="el" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="el" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a>)</td></tr>
<tr class="memdesc:a05a2db6bf3cc2160f0b13c6cb3e31a18"><td class="mdescLeft">&#160;</td><td class="mdescRight">Required math function: Channel-wise empirical variance calculation.  <a href="structailayer__batch__norm.html#a05a2db6bf3cc2160f0b13c6cb3e31a18">More...</a><br /></td></tr>
<tr class="separator:a05a2db6bf3cc2160f0b13c6cb3e31a18"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac42e8741878f9c5f21fa033e8dc344c4"><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#ac42e8741878f9c5f21fa033e8dc344c4">exponential_moving_average</a> )(const <a class="el" href="structaitensor.html">aitensor_t</a> *new_data, const void *<a class="el" href="structailayer__batch__norm.html#a4be2a7d03bb9aeca3a064739b167098a">momentum</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *average)</td></tr>
<tr class="memdesc:ac42e8741878f9c5f21fa033e8dc344c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Required math function: Exponential moving average.  <a href="structailayer__batch__norm.html#ac42e8741878f9c5f21fa033e8dc344c4">More...</a><br /></td></tr>
<tr class="separator:ac42e8741878f9c5f21fa033e8dc344c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5db4592396e5ab43fc55de673c318aae"><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a5db4592396e5ab43fc55de673c318aae">batch_norm</a> )(const <a class="el" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="el" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *offsets, const <a class="el" href="structaitensor.html">aitensor_t</a> *scales, const void *<a class="el" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a5db4592396e5ab43fc55de673c318aae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Required math function: Batch Normalization.  <a href="structailayer__batch__norm.html#a5db4592396e5ab43fc55de673c318aae">More...</a><br /></td></tr>
<tr class="separator:a5db4592396e5ab43fc55de673c318aae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3f31c6b5eadced42f76d88aac2fbe5b6"><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__batch__norm.html#a3f31c6b5eadced42f76d88aac2fbe5b6">d_batch_norm</a> )(const <a class="el" href="structaitensor.html">aitensor_t</a> *x_in, int8_t axis, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *vars, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a88bc32827b45ca03a858d6dbc85b9a48">betas</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a81edfab4c4a52c6537f3f0ee19a0d2a4">gammas</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *delta_out, const void *<a class="el" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *delta_in, <a class="el" href="structaitensor.html">aitensor_t</a> *d_betas, <a class="el" href="structaitensor.html">aitensor_t</a> *d_gammas)</td></tr>
<tr class="memdesc:a3f31c6b5eadced42f76d88aac2fbe5b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Required math function: Gradients of Batch Normalization.  <a href="structailayer__batch__norm.html#a3f31c6b5eadced42f76d88aac2fbe5b6">More...</a><br /></td></tr>
<tr class="separator:a3f31c6b5eadced42f76d88aac2fbe5b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>General <a class="el" href="ailayer__batch__normalization_8h.html">Batch Normalization layer </a> structure. </p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="a5db4592396e5ab43fc55de673c318aae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5db4592396e5ab43fc55de673c318aae">&#9670;&nbsp;</a></span>batch_norm</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(* batch_norm) (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="el" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *offsets, const <a class="el" href="structaitensor.html">aitensor_t</a> *scales, const void *<a class="el" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Required math function: Batch Normalization. </p>
<p>Requires a math function that performs Batch Normalization:<br  />
 </p><p class="formulaDsp">
\[ y_{i,j} = \mathit{BN}(x_{i,j}) = \gamma_i \cdot \frac{x_{i,j} - \mu_{i}}{\sqrt{\sigma_{i}^2+\epsilon}} + \beta_i \]
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>Input tensor. </td></tr>
    <tr><td class="paramname">channel_axis</td><td>Axis of the input tensor that stores the channel dimension. </td></tr>
    <tr><td class="paramname">means</td><td>Vector with the means ( \( \mu_i \)) of every channel. </td></tr>
    <tr><td class="paramname">variances</td><td>Vector with the variances ( \( \sigma^2_i \)) of every channel. </td></tr>
    <tr><td class="paramname">offsets</td><td>Vector with the offset parameters ( \( \beta_i \)) of every channel. </td></tr>
    <tr><td class="paramname">scales</td><td>Vector with the scaling parameters ( \( \gamma_i \)) of every channel. </td></tr>
    <tr><td class="paramname">eps</td><td>Small constant for numerical stability. </td></tr>
    <tr><td class="paramname">result</td><td>The resulting normalized tensor. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3f31c6b5eadced42f76d88aac2fbe5b6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3f31c6b5eadced42f76d88aac2fbe5b6">&#9670;&nbsp;</a></span>d_batch_norm</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(* d_batch_norm) (const <a class="el" href="structaitensor.html">aitensor_t</a> *x_in, int8_t axis, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *vars, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a88bc32827b45ca03a858d6dbc85b9a48">betas</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a81edfab4c4a52c6537f3f0ee19a0d2a4">gammas</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *delta_out, const void *<a class="el" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *delta_in, <a class="el" href="structaitensor.html">aitensor_t</a> *d_betas, <a class="el" href="structaitensor.html">aitensor_t</a> *d_gammas)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Required math function: Gradients of Batch Normalization. </p>
<p>Requires a math function that calculates the derivative of the Batch Normalization with respect to the input and the trainable parameters ( \( \beta \) and \( \gamma \)).<br  />
 Please refer to the paper by Ioffe and Szegedy (<a href="https://arxiv.org/abs/1502.03167">https://arxiv.org/abs/1502.03167</a>) for the equations of the gradients.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>Input tensor. </td></tr>
    <tr><td class="paramname">channel_axis</td><td>Axis of the input tensor that stores the channel dimension. </td></tr>
    <tr><td class="paramname">means</td><td>Vector with the means ( \( \mu_i \)) of every channel. </td></tr>
    <tr><td class="paramname">variances</td><td>Vector with the variances ( \( \sigma^2_i \)) of every channel. </td></tr>
    <tr><td class="paramname">betas</td><td>Vector with the offset parameters ( \( \beta_i \)) of every channel. </td></tr>
    <tr><td class="paramname">gammas</td><td>Vector with the scaling parameters ( \( \gamma_i \)) of every channel. </td></tr>
    <tr><td class="paramname">delta_out</td><td>Gradient calculated by the output layer for gradient backpropagation. </td></tr>
    <tr><td class="paramname">eps</td><td>Small constant for numerical stability. </td></tr>
    <tr><td class="paramname">delta_in</td><td>The resulting gradients of the input ( \( \mathrm{d}\mathcal{L} / \mathrm{d}x \)). </td></tr>
    <tr><td class="paramname">d_betas</td><td>The resulting gradients of the \( \beta \) parameter ( \( \mathrm{d}\mathcal{L} / \mathrm{d}\beta \)). </td></tr>
    <tr><td class="paramname">d_gammas</td><td>The resulting gradients of the \( \gamma \) parameter ( \( \mathrm{d}\mathcal{L} / \mathrm{d}\gamma \)). </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a7a06fdbdd9e5f95ddc00f8bf65297f65"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7a06fdbdd9e5f95ddc00f8bf65297f65">&#9670;&nbsp;</a></span>empirical_mean_channelwise</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(* empirical_mean_channelwise) (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="el" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Required math function: Channel-wise empirical mean calculation. </p>
<p>Requires a math function that calculates the empirical mean for each channel of the given axis:<br  />
 </p><p class="formulaDsp">
\[ means_i = \frac{1}{m} \sum_{j=1}^{m} x_{i,j} \]
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>Input tensor </td></tr>
    <tr><td class="paramname">channel_axis</td><td>Axis of the input tensor that stores the channel dimension. </td></tr>
    <tr><td class="paramname">means</td><td>Resulting mean vector (1D) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a05a2db6bf3cc2160f0b13c6cb3e31a18"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a05a2db6bf3cc2160f0b13c6cb3e31a18">&#9670;&nbsp;</a></span>empirical_variance_channelwise</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(* empirical_variance_channelwise) (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="el" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, const <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *<a class="el" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a>)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Required math function: Channel-wise empirical variance calculation. </p>
<p>Requires a math function that calculates the empirical variance for each channel of the given axis:<br  />
 </p><p class="formulaDsp">
\[ variances_i = \frac{1}{m} \sum_{j=1}^{m} (x_{i,j} - \mu_i)^2 \]
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>Input tensor </td></tr>
    <tr><td class="paramname">channel_axis</td><td>Axis of the input tensor that stores the channel dimension. </td></tr>
    <tr><td class="paramname">means</td><td>Channel-wise mean values (1D) </td></tr>
    <tr><td class="paramname">variances</td><td>Resulting variance vector (1D) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac42e8741878f9c5f21fa033e8dc344c4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac42e8741878f9c5f21fa033e8dc344c4">&#9670;&nbsp;</a></span>exponential_moving_average</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(* exponential_moving_average) (const <a class="el" href="structaitensor.html">aitensor_t</a> *new_data, const void *<a class="el" href="structailayer__batch__norm.html#a4be2a7d03bb9aeca3a064739b167098a">momentum</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *average)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Required math function: Exponential moving average. </p>
<p>Requires a math function that updates the moving average with a new data point:<br  />
 </p><p class="formulaDsp">
\[ average \leftarrow momentum \cdot average + (1 - momentum) \cdot newdata \]
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">new_data</td><td>Input tensor with the new data point. </td></tr>
    <tr><td class="paramname">momentum</td><td>aiscalar_t which controls the momentum of the average (range [0, 1]). </td></tr>
    <tr><td class="paramname">average</td><td>The average that is modified (input and output value), </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ailayer__batch__normalization_8h_source.html">ailayer_batch_normalization.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="structailayer__batch__norm.html">ailayer_batch_norm</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
